@extends('Admin.Layouts.index')

@section('active4')
    active
@endsection

@section('title_name')
    发布文章
@endsection

@section('container')
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
<div class="container">
    <div class="mws-panel grid_8">
        <div class="mws-panel-header">
        <span>
            发布文章
        </span>
        </div>
        <div class="mws-panel-body no-padding">
            @if(count($errors)>0)
                <div class="mws-form-message error">
                    <ul>
                        @foreach($errors->all() as $error)
                            <li>{{$error}}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
            <form class="mws-form" action="/admin/articles/insert" method="post" enctype="multipart/form-data">
                {{csrf_field()}}
                <div class="mws-form-inline">
                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            标题
                        </label>
                        <div class="mws-form-item">
                            <input class="small" type="text" name="title">
                        </div>
                    </div>
                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            选择分类
                        </label>
                        <div class="mws-form-item">
                            <select class="large" name="cate_id">
                            @foreach($cates as $k=>$v)
                                <option value="{{$v['id']}}">{{$v['name']}}</option>
                            @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            文章配图
                        </label>
                        <div class="mws-form-item">
                            <input type="file" name="picture" placeholder="请选择图片">
                        </div>
                    </div>
                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            文章简介
                        </label>
                        <div class="mws-form-item">
                        <textarea rows="" cols="" class="large" name="descr"></textarea>
                        </div>
                    </div>
                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            文章详情
                        </label>
                        <div class="mws-form-item">
                            <textarea id="editor" type="text/plain" style="width:100%;height:500px;" name="content"></textarea>
                        </div>
                    </div>
                </div>
                <div class="mws-button-row">
                    <input value="发布" class="btn btn-danger" type="submit">
                    <input value="重置" class="btn " type="reset">
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    var ue = UE.getEditor('editor');
</script>
@endsection